package net.url;

import java.io.BufferedInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URL;

public class SouceViewer4
{
	public static void main(String[] args)
	{
		URL.setURLStreamHandlerFactory(new NewFactory());
		try
		{
			URL u = new URL("http://www.baidu.com");
			InputStream in = new BufferedInputStream(u.openStream());
			Reader r = new InputStreamReader(in);
			int c;
			while((c=r.read())!=-1)
			{
				System.out.println((char)c);
			}
		}
		catch (Exception e)
		{
		}
	}
}
